<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Execute a query that does not prefetch and buffer all data</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-udf-encode-binary.html">sqlite_udf_encode_binary</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-valid.html">sqlite_valid</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.sqlite-unbuffered-query" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlite_unbuffered_query</h1>
  <h1 class="refname">SQLiteDatabase::unbufferedQuery</h1>
  <p class="verinfo">(PHP 5 &lt; 5.4.0, PECL sqlite &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_unbuffered_query</span> -- <span class="refname">SQLiteDatabase::unbufferedQuery</span> &mdash; <span class="dc-title">Execute a query that does not prefetch and buffer all data</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sqlite-unbuffered-query-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>sqlite_unbuffered_query</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$dbhandle</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$result_type</code><span class="initializer"> = SQLITE_BOTH</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_msg</code></span>
  ]] )</div>

  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>sqlite_unbuffered_query</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter">$dbhandle</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$result_type</code><span class="initializer"> = SQLITE_BOTH</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_msg</code></span>   
  ]] )</div>

  <p class="para rdfs-comment">面向对象风格 (method):</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type SQLiteUnbuffered">SQLiteUnbuffered</span></span> <span class="methodname"><strong>SQLiteDatabase::unbufferedQuery</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$result_type</code><span class="initializer"> = SQLITE_BOTH</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_msg</code></span>
  ]] )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>sqlite_unbuffered_query()</strong></span> is identical to
   <span class="function"><a href="function.sqlite-query.html" class="function">sqlite_query()</a></span> except that the result that is returned
   is a sequential forward-only result set that can only be used to read
   each row, one after the other.
  </p>
  <p class="para">
   This function is ideal for generating things such as HTML tables where
   you only need to process one row at a time and don&#039;t need to randomly
   access the row data.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Functions such as <span class="function"><a href="function.sqlite-seek.html" class="function">sqlite_seek()</a></span>, 
    <span class="function"><a href="function.sqlite-rewind.html" class="function">sqlite_rewind()</a></span>, <span class="function"><a href="function.sqlite-next.html" class="function">sqlite_next()</a></span>,
    <span class="function"><a href="function.sqlite-current.html" class="function">sqlite_current()</a></span>, and
    <span class="function"><a href="function.sqlite-num-rows.html" class="function">sqlite_num_rows()</a></span> do not work on result handles
    returned from <span class="function"><strong>sqlite_unbuffered_query()</strong></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sqlite-unbuffered-query-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">dbhandle</code></em></dt>

     <dd>

      <p class="para">
       The SQLite Database resource; returned from
       <span class="function"><a href="function.sqlite-open.html" class="function">sqlite_open()</a></span> when used procedurally. This parameter
       is not required when using the object-oriented method.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">query</code></em></dt>

     <dd>

      <p class="para">
       The query to be executed.
      </p>
      <p class="para">
       Data inside the query should be <a href="function.sqlite-escape-string.html" class="link">properly escaped</a>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">result_type</code></em></dt>

     <dd>

      <p class="para">可选的 <em><code class="parameter">result_type</code></em>
参数接受常量，且决定返回的数组如何被索引。使用
<strong><code>SQLITE_ASSOC</code></strong> 会仅返回关联索引（已命名字段），而
<strong><code>SQLITE_NUM</code></strong> 会仅返回数值索引。<strong><code>SQLITE_BOTH</code></strong>
会同时返回关联和数值索引。<strong><code>SQLITE_BOTH</code></strong> 是此函数的默认值。</p>
     </dd>

    
    
     <dt>
<em><code class="parameter">error_msg</code></em></dt>

     <dd>

      <p class="para">
       The specified variable will be filled if an error occurs. This is
       specially important because SQL syntax errors can&#039;t be fetched using
       the <span class="function"><a href="function.sqlite-last-error.html" class="function">sqlite_last_error()</a></span> function.
      </p>
     </dd>

    
   </dl>

  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">为兼容其他数据库扩展(比如 MySQL)，支持两种可替代的语法。推荐第一种格式，函数的第一个参数是<em><code class="parameter">dbhandle</code></em>。</span></p></blockquote>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sqlite-unbuffered-query-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a result handle 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
  <p class="para">
   <span class="function"><strong>sqlite_unbuffered_query()</strong></span> returns a sequential
   forward-only result set that can only be used to read each row, one after
   the other.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.sqlite-unbuffered-query-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.1.0</td>
       <td>
        Added the <em><code class="parameter">error_msg</code></em> parameter
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sqlite-unbuffered-query-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.sqlite-query.html" class="function" rel="rdfs-seeAlso">sqlite_query()</a> - Executes a query against a given database and returns a result handle</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-udf-encode-binary.html">sqlite_udf_encode_binary</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-valid.html">sqlite_valid</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
